// 每隔1秒自动切换图片

// 当鼠标移动到元素上时停止切换，移出后开始切换

var abc = (function () {
    var  = document.querySelector('img');
  var index = 1;
  var timerId = null;
  function changeImg() {
    index++;
    if (index > 4) {
      index = 1;
    }
    
    imgContainer.src = './img/' + index + '.jpeg';
  }

  function startChange() {
    if (timerId) {
      return;
    }
    timerId = setInterval(() => {
      changeImg();
    }, 1000);
  }
  function stopChange() {
    clearInterval(timerId);
    timerId = null;
  }



  return { startChange, stopChange };
})();
